473,420 Members | 1,618 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,420 software developers and data experts.

Escape single quote in string

DDE
Hi,

wich way can I escape a string sent to an OleDbComman containing single
quote?

Thanks

Dominique
Nov 15 '05 #1
6 22057
Use an OledbParameter instead and let it take care of it for you.
"DDE" <dd*@iaireinfo.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

wich way can I escape a string sent to an OleDbComman containing single
quote?

Thanks

Dominique

Nov 15 '05 #2
Hi,

I think that it depends of the DB engine you are talking to. I would search
on the product documentation first and/or not found I would try escape it
with the same ' , with a " or enclosing the string in [ ]

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"DDE" <dd*@iaireinfo.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

wich way can I escape a string sent to an OleDbComman containing single
quote?

Thanks

Dominique

Nov 15 '05 #3
DDE
Hi,

I am not using Parameters in this case, I am just lookin for a method to do
the thing.

Dominique

"William Ryan" <do********@comcast.nospam.net> wrote in message
news:eq**************@tk2msftngp13.phx.gbl...
Use an OledbParameter instead and let it take care of it for you.
"DDE" <dd*@iaireinfo.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

wich way can I escape a string sent to an OleDbComman containing single
quote?

Thanks

Dominique


Nov 15 '05 #4
DDE
I am not using a constant string but a structure element.

Dominique
"Ignacio Machin" <ignacio.machin AT dot.state.fl.us> wrote in message
news:#4**************@TK2MSFTNGP09.phx.gbl...
Hi,

I think that it depends of the DB engine you are talking to. I would search on the product documentation first and/or not found I would try escape it
with the same ' , with a " or enclosing the string in [ ]

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"DDE" <dd*@iaireinfo.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

wich way can I escape a string sent to an OleDbComman containing single
quote?

Thanks

Dominique


Nov 15 '05 #5
Typically, if you Do a string.replace and replace the single quote with
double quotes, it will work for most RDBMS systems. This will do it even if
there's no quote present, the replace will just be ignored. I highly
recommend against this type of methodology, but if you are sure this is what
you want to do...

Dim s As String = "O'Brien"

MessageBox.Show(s.Replace("'", "''"))

"DDE" <dd*@iaireinfo.com> wrote in message
news:O3**************@TK2MSFTNGP11.phx.gbl...
Hi,

I am not using Parameters in this case, I am just lookin for a method to do the thing.

Dominique

"William Ryan" <do********@comcast.nospam.net> wrote in message
news:eq**************@tk2msftngp13.phx.gbl...
Use an OledbParameter instead and let it take care of it for you.
"DDE" <dd*@iaireinfo.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

wich way can I escape a string sent to an OleDbComman containing single quote?

Thanks

Dominique



Nov 15 '05 #6
Hi,

At the end you will have to assign the query to OleDbCommand.CommandText ,
this is a string property, this is where you can do the substitution I'm
talking about

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"DDE" <dd*@iaireinfo.com> wrote in message
news:Or*************@TK2MSFTNGP11.phx.gbl...
I am not using a constant string but a structure element.

Dominique
"Ignacio Machin" <ignacio.machin AT dot.state.fl.us> wrote in message
news:#4**************@TK2MSFTNGP09.phx.gbl...
Hi,

I think that it depends of the DB engine you are talking to. I would

search
on the product documentation first and/or not found I would try escape it with the same ' , with a " or enclosing the string in [ ]

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"DDE" <dd*@iaireinfo.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

wich way can I escape a string sent to an OleDbComman containing single quote?

Thanks

Dominique



Nov 15 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Alden Streeter | last post by:
Here is the HTML that is being output by my asp page: <a href='Files/category/computers/bigimages/computers-sub-monitors.jpg' target='_blank' onMouseOver="window.status='Click for a larger image...
7
by: teachtiro | last post by:
Hi, 'C' says \ is the escape character to be used when characters are to be interpreted in an uncommon sense, e.g. \t usage in printf(), but for printing % through printf(), i have read that %%...
18
by: Steve Litvack | last post by:
Hello, I have built an XMLDocument object instance and I get the following string when I examine the InnerXml property: <?xml version=\"1.0\"?><ROOT><UserData UserID=\"2282\"><Tag1...
7
by: Luminal | last post by:
Greetings I'm having some problems on my C# application. I'm using an access database and I'm not able to do select queries with the ' character. My code is this: // some previous code like...
12
by: Jeff S | last post by:
In a VB.NET code behind module, I build a string for a link that points to a JavaScript function. The two lines of code below show what is relevant. PopupLink = "javascript:PopUpWindow(" &...
6
by: HK guy | last post by:
In C#, it has a escape chatacter @ then can ingnore all the escape charactrer in string, how about in VB.NET, any escape character like @? Thank you
131
by: Lawrence D'Oliveiro | last post by:
The "escape" function in the "cgi" module escapes characters with special meanings in HTML. The ones that need escaping are '<', '&' and '"'. However, cgi.escape only escapes the quote character if...
8
by: Marina Levit [MVP] | last post by:
I've scoured google, but apparently none of the suggestions actually work. I have the following. type of XPATH query "SomeNode[SomeAttribute = 'abc's search'" Now, I've tried doing this: ...
3
by: Tiger Champ | last post by:
hi all, I want to output something this way: Select 'This is 'A' book' from ... how to do this?
1
by: crybaby | last post by:
I wrote a python code in linux text pad and copied to thumb drive and try to ran the file by changing the path to windows: sys.path = sys.path + I get the following error: ValueError:...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.